package behavior.observer;

import java.util.ArrayList;
import java.util.List;

public class Teacher {
	
	private String phone;
	
	private List<Student> stuList = new ArrayList<>();
	
	public void addStudent(Student stu){
		stuList.add(stu);
	}
	
	public void setPhone(String phone){
		this.phone = phone;
		notifyStudent();
	}
	
	private void notifyStudent(){
		for (Student student : stuList) {
			student.setTeacherPhone(phone);
		}
	}
	
}
